We focus on obj #1: are urban interventions tend to be located in low SES neighborhoods. Here, the urban interventions considered are bike lanes and canopy/tree coverage and low SES ~ high Pampalon deprivation index. In a second step, we will look at the variations of UI and SES and their association.
Data extraction and pre-analyses for the paper looking at BEI and equity. BEI comprise bike lanes and canopy changes while equity is measured through Pampalon deprivation index. (Partially adapted from original work on BEI bike lanes – see bike_lane_stats.R and ReadMe.md.)
Paper is available here.
General processing steps:
In a second phase, these BEI changes will be linked to Pampalon index for 2016 (and 2011 ?)
UPDATE 2021-12-02 Following discussion with @Yan, add normalized bike line changes:
UPDATE 2021-12-08 Following discussion with @Yan
We use data categorized by Philippe Apparicio’s team who manually identified bike lanes for each census year since 1991. For this study, we limit ourselves to 2016 and 2011 census years.
On top of the original CT boundaries, three levels of buffer have been applied to the CT – 250m, 500m & 750m. Then the same series of processing steps (see above) have been applied to the buffers.
# Bike lanes, from Ph. Apparicio
reseau <- st_read(dsn="data/ReseauCyclableFinal.gdb", layer = "Reseau") # Already in NAD83 / MTM zone 8
## Reading layer `Reseau' from data source
## `/Users/benoit/WORKSPACE/gentrification_BEI_equity/data/ReseauCyclableFinal.gdb'
## using driver `OpenFileGDB'
## Simple feature collection with 82166 features and 72 fields
## Geometry type: GEOMETRY
## Dimension: XYZ, XYZM
## Bounding box: xmin: 266985.5 ymin: 5029251 xmax: 320986.1 ymax: 5062652
## z_range: zmin: 0 zmax: 43
## m_range: mmin: 0 mmax: 43
## Projected CRS: NAD83 / MTM zone 8
bike_lane <- reseau %>%
filter(An2016 == 1 | An2011 == 1) %>%
select(IdRte, ClsRte, Zone, starts_with("An"), starts_with("Typo_")) %>%
st_cast("MULTILINESTRING") # Get rid of a few MULTICURVE geometries
# CT boundaries for Montreal
CT16 <- get_census(dataset='CA16', regions=list(CMA='24462'), level='CT', geo_format = "sf") %>%
filter(Type == "CT") %>%
mutate(interact_aoi = CD_UID %in% c(2466, 2465, 2458)) %>% # Flag Montréal island, Laval and the South shore (Longueuil, St-Lambert, Brossard)
st_transform(st_crs(bike_lane))
## Reading geo data from local cache.
CT11 <- get_census(dataset='CA11', regions=list(CMA='24462'), level='CT', geo_format = "sf") %>%
filter(Type == "CT") %>%
st_transform(st_crs(bike_lane))
## Reading geo data from local cache.
compute_bikelane_by_area <- function(sf_areas, year_fld, typo_fld) {
# Compute length of bike lanes within each area.
# --
# Parameters:
# - sf_areas: sf class object defining the areas of interest, must have a GeoUID field
# - year_fld: field name specifying the year of interest, e.g. An2016
# - typo_fld: field name specifying the typology for the year of interest, e.g. Typo_2016
year_fld <- enquo(year_fld)
typo_fld <- enquo(typo_fld)
# Compute intersection of bike lanes with areas
bk <- bike_lane %>%
filter(!!year_fld == 1) %>%
st_intersection(sf_areas) %>%
mutate(bike_lane_length = st_length(.)) %>%
as.data.frame() %>%
group_by(GeoUID, !!typo_fld) %>%
summarise(bike_lane_length = sum(bike_lane_length)) %>%
ungroup() %>%
pivot_wider(names_from = !!typo_fld, names_prefix = "Bike_class", names_sort = TRUE,
values_from = bike_lane_length, values_fill = units::set_units(0, m)) %>%
mutate(Bike_lane_total = units::set_units(rowSums(select(., starts_with("Bike_class"))), m))
# Merge back into original sf_areas
bk <- sf_areas %>%
left_join(bk)
# Replace NA by 0, which occur in Bike_class length
bk[is.na(bk)] <- 0
return(bk)
}
compute_streetlength_by_area <- function(sf_areas) {
# Compute length of streets within each area.
# --
# Parameters:
# - sf_areas: sf class object defining the areas of interest, must have a GeoUID field
# Compute intersection of streets with areas
bk <- reseau %>%
st_cast("MULTILINESTRING") %>% # Get rid of a few MULTICURVE geometries
st_intersection(sf_areas) %>%
mutate(street_length = st_length(.)) %>%
as.data.frame() %>%
group_by(GeoUID) %>%
summarise(street_length = sum(street_length)) %>%
ungroup()
# Merge back into original sf_areas
bk <- sf_areas %>%
mutate(shape_area_km2 = units::set_units(st_area(.), 'km^2')) %>%
left_join(bk)
# Replace NA by 0
bk[is.na(bk)] <- 0
return(bk)
}
# Compute year 2016 and year 2011 bike lanes within 2016 CTs
# NB: contrary to the original work, we keep the same area of reference, i.e. 2016
bike_lane_by_CT16 <- compute_bikelane_by_area(CT16, An2016, Typo_2016)
bike_lane_by_CT11 <- compute_bikelane_by_area(CT16, An2011, Typo_2011)
bike_lane_by_CT06 <- compute_bikelane_by_area(CT16, An2006, Typo_2006)
# Compute buffers, with 3 radii and for each census year
radii <- c(250, 500, 750)
buf_CT16 <- lapply(radii, st_buffer, x=CT16)
names(buf_CT16) <- lapply(radii, function(b) {paste0("buf", b)})
# Compute bike length for each buffer/census year
buf_CT16_w_bike_length <- lapply(buf_CT16, compute_bikelane_by_area, year_fld=An2016, typo_fld=Typo_2016)
names(buf_CT16_w_bike_length) <- lapply(radii, function(b) {paste0("buf", b)})
buf_CT16_w_bike_length$original <- bike_lane_by_CT16
buf_CT11_w_bike_length <- lapply(buf_CT16, compute_bikelane_by_area, year_fld=An2011, typo_fld=Typo_2011)
names(buf_CT11_w_bike_length) <- lapply(radii, function(b) {paste0("buf", b)})
buf_CT11_w_bike_length$original <- bike_lane_by_CT11
buf_CT06_w_bike_length <- lapply(buf_CT16, compute_bikelane_by_area, year_fld=An2006, typo_fld=Typo_2006)
names(buf_CT06_w_bike_length) <- lapply(radii, function(b) {paste0("buf", b)})
buf_CT06_w_bike_length$original <- bike_lane_by_CT06
# Compute total street length within CT/buffer
street_length_by_CT16 <- compute_streetlength_by_area(CT16)
buf_CT16_street_length <- lapply(buf_CT16, compute_streetlength_by_area)
names(buf_CT16_street_length) <- lapply(radii, function(b) {paste0("buf", b)})
buf_CT16_street_length$original <- street_length_by_CT16
# Reorganize data to have all data in one dataframe
bike_lane_changes <- CT16 %>%
left_join(select(as.data.frame(buf_CT16_street_length$original), GeoUID, street_length, shape_area_km2), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT16_street_length$buf250), GeoUID, street_length, shape_area_km2), by="GeoUID", suffix=c(".ct", ".b250")) %>%
left_join(select(as.data.frame(buf_CT16_street_length$buf500), GeoUID, street_length, shape_area_km2), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT16_street_length$buf750), GeoUID, street_length, shape_area_km2), by="GeoUID", suffix=c(".b500", ".b750")) %>%
left_join(select(as.data.frame(buf_CT16_w_bike_length$original), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT11_w_bike_length$original), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2016ct", ".2011ct")) %>%
left_join(select(as.data.frame(buf_CT16_w_bike_length$buf250), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT11_w_bike_length$buf250), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2016b250", ".2011b250")) %>%
left_join(select(as.data.frame(buf_CT16_w_bike_length$buf500), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT11_w_bike_length$buf500), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2016b500", ".2011b500")) %>%
left_join(select(as.data.frame(buf_CT16_w_bike_length$buf750), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT11_w_bike_length$buf750), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2016b750", ".2011b750")) %>%
left_join(select(as.data.frame(buf_CT06_w_bike_length$original), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT06_w_bike_length$buf250), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2006ct", ".2006b250")) %>%
left_join(select(as.data.frame(buf_CT06_w_bike_length$buf500), GeoUID, starts_with("Bike_")), by="GeoUID") %>%
left_join(select(as.data.frame(buf_CT06_w_bike_length$buf750), GeoUID, starts_with("Bike_")), by="GeoUID", suffix=c(".2006b500", ".2006b750"))
# Compute ratio of bike lane vs street length
bike_lane_changes <- bike_lane_changes %>%
mutate(Bike_lane.by.street.2011ct = 100 * Bike_lane_total.2011ct / street_length.ct,
Bike_lane.by.street.2011b250 = 100 * Bike_lane_total.2011b250 / street_length.b250,
Bike_lane.by.street.2011b500 = 100 * Bike_lane_total.2011b500 / street_length.b500,
Bike_lane.by.street.2011b750 = 100 * Bike_lane_total.2011b750 / street_length.b750,
Bike_lane.by.street.2016ct = 100 * Bike_lane_total.2016ct / street_length.ct,
Bike_lane.by.street.2016b250 = 100 * Bike_lane_total.2016b250 / street_length.b250,
Bike_lane.by.street.2016b500 = 100 * Bike_lane_total.2016b500 / street_length.b500,
Bike_lane.by.street.2016b750 = 100 * Bike_lane_total.2016b750 / street_length.b750,
Bike_lane.by.street.2006ct = 100 * Bike_lane_total.2006ct / street_length.ct,
Bike_lane.by.street.2006b250 = 100 * Bike_lane_total.2006b250 / street_length.b250,
Bike_lane.by.street.2006b500 = 100 * Bike_lane_total.2006b500 / street_length.b500,
Bike_lane.by.street.2006b750 = 100 * Bike_lane_total.2006b750 / street_length.b750)
# Compute change between 2011 and 2016 (only for total bike lane length)
bike_lane_changes <- bike_lane_changes %>%
mutate(Bike_lane_diff.2011.2016ct = Bike_lane_total.2016ct - Bike_lane_total.2011ct,
Bike_lane_diff.2011.2016b250 = Bike_lane_total.2016b250 - Bike_lane_total.2011b250,
Bike_lane_diff.2011.2016b500 = Bike_lane_total.2016b500 - Bike_lane_total.2011b500,
Bike_lane_diff.2011.2016b750 = Bike_lane_total.2016b750 - Bike_lane_total.2011b750)
# Normalize bike lane change by (i) street length and (ii) area
bike_lane_changes <- bike_lane_changes %>%
mutate(Bike_lane_diff.by.street.2011.2016ct = 100 * Bike_lane_diff.2011.2016ct / street_length.ct,
Bike_lane_diff.by.street.2011.2016b250 = 100 * Bike_lane_diff.2011.2016b250 / street_length.b250,
Bike_lane_diff.by.street.2011.2016b500 = 100 * Bike_lane_diff.2011.2016b500 / street_length.b500,
Bike_lane_diff.by.street.2011.2016b750 = 100 * Bike_lane_diff.2011.2016b750 / street_length.b750,
Bike_lane_diff.by.area.2011.2016ct = Bike_lane_diff.2011.2016ct / shape_area_km2.ct,
Bike_lane_diff.by.area.2011.2016b250 = Bike_lane_diff.2011.2016b250 / shape_area_km2.b250,
Bike_lane_diff.by.area.2011.2016b500 = Bike_lane_diff.2011.2016b500 / shape_area_km2.b500,
Bike_lane_diff.by.area.2011.2016b750 = Bike_lane_diff.2011.2016b750 / shape_area_km2.b750)
# Save results
st_write(bike_lane_changes, dsn = "data/bike_length_changes.gpkg", delete_layer = TRUE)
## Deleting layer `bike_length_changes' using driver `GPKG'
## Writing layer `bike_length_changes' to data source
## `data/bike_length_changes.gpkg' using driver `GPKG'
## Writing 970 features with 140 fields and geometry type Multi Polygon.
# Clean up
rm(buf_CT16)
rm(bike_lane_by_CT11, bike_lane_by_CT16)
rm(buf_CT11_w_bike_length, buf_CT16_w_bike_length)
rm(street_length_by_CT16, buf_CT16_street_length)
Check output for one specific dataset (Census tracts 2016, no buffer)
Bike lane length in 2016 within CTs, measured in meters
ggplot() +
geom_sf(data=filter(bike_lane_changes, interact_aoi), mapping = aes(fill=as.numeric(Bike_lane_total.2016ct)), lwd=0) +
scale_fill_continuous(name = "Total length (m)")+
labs(title = "Length of bike lanes within 2016 CTs", subtitle = "(INTERACT study area || for control only)")
Absolute bike lane length change between 2011 and 2016, in meters
ggplot() +
geom_sf(data=filter(bike_lane_changes, interact_aoi), mapping = aes(fill=as.numeric(Bike_lane_diff.2011.2016ct)), lwd=0) +
scale_fill_gradient2(name = "Length (m)")+
labs(title = "Changes in bike lane between 2011 and 2016", subtitle = "(INTERACT study area || CT level || for control only)")
Relative bike lane length change between 2011 and 2016, normalized by street length within CT in 2016, expressed in %
\[Variation = \frac{Bike Lane_{2016}}{Street Length_{2016}} - \frac{Bike Lane_{2011}}{Street Length_{2016}}\]
ggplot() +
geom_sf(data=filter(bike_lane_changes, interact_aoi), mapping = aes(fill=as.numeric(Bike_lane_diff.by.street.2011.2016ct)), lwd=0) +
scale_fill_gradient2(name = "Variation (%)")+
labs(title = "Changes in bike lane between 2011 and 2016, normalized by street", subtitle = "(INTERACT study area || CT level || for control only)")
Relative bike lane length change between 2011 and 2016, normalized by CT area, expressed in \(\frac{km}{km^{2}}\)
\[Ratio = \frac{Bike Lane_{2016}}{CT Area_{2016}} - \frac{Bike Lane_{2011}}{CT Area_{2016}}\]
ggplot() +
geom_sf(data=filter(bike_lane_changes, interact_aoi), mapping = aes(fill=as.numeric(Bike_lane_diff.by.area.2011.2016ct)), lwd=0) +
scale_fill_gradient2(name = "Ratio (1/km)")+
labs(title = "Changes in bike lane between 2011 and 2016, normalized by area", subtitle = "(INTERACT study area || CT level || for control only)")
After some discussion with Yan, we envision using a relative bike lane length ratio change between 2011 and 2016, normalized by the ratio in 2011, expressed in %
\[Variation = \frac{\frac{Bike Lane_{2016}}{Street Length_{2016}} - \frac{Bike Lane_{2011}}{Street Length_{2016}}}{\frac{Bike Lane_{2011}}{Street Length_{2016}}} = \frac{Bike Lane_{2016} - Bike Lane_{2011}}{Bike Lane_{2011}}\]
Problem: all CT with no bike lane in 2011 get a missing data, contrary to the original metric, which measured the absolute variation of the ratio of bike lane to street length.
.bike_lane_changes <- bike_lane_changes %>%
mutate(Bike_lane_diff.by.street.relative.2011.2016ct = Bike_lane_diff.by.street.2011.2016ct / (Bike_lane_total.2011ct / street_length.ct))
ggplot() +
geom_sf(data=filter(.bike_lane_changes, interact_aoi), mapping = aes(fill=as.numeric(Bike_lane_diff.by.street.relative.2011.2016ct)), lwd=0) +
scale_fill_gradient2(name = "Ratio")+
labs(title = "Changes in bike lane ratio between 2011 and 2016, normalized by ratio in 2011", subtitle = "(INTERACT study area || CT level || for control only)")
# CT level
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.2011.2016ct)), binwidth = 250) +
xlab("Difference of bike lane length between 2016 and 2011 | CT level")
summary(bike_lane_changes$Bike_lane_diff.2011.2016ct)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -1377.7 0.0 0.0 262.1 189.7 14463.8
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.street.2011.2016ct))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by street")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 252 rows containing non-finite values (stat_bin).
summary(bike_lane_changes$Bike_lane_diff.by.street.2011.2016ct)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -100.000 0.000 0.000 3.665 4.496 100.000 252
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.area.2011.2016ct))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by area")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(bike_lane_changes$Bike_lane_diff.by.area.2011.2016ct)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -1.1474 0.0000 0.0000 0.4237 0.1764 8.9852
ggplot(.bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.street.relative.2011.2016ct))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by ratio in 2011")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 461 rows containing non-finite values (stat_bin).
summary(.bike_lane_changes$Bike_lane_diff.by.street.relative.2011.2016ct)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -100.0000 0.0000 0.2199 Inf 102.7796 Inf 367
# buf250 level
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.2011.2016b250)), binwidth = 250) +
xlab("Difference of bike lane length between 2016 and 2011 | buf 250m")
summary(bike_lane_changes$Bike_lane_diff.2011.2016b250)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3452.5 0.0 0.0 646.7 933.8 20786.8
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.street.2011.2016b250))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by street")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 233 rows containing non-finite values (stat_bin).
summary(bike_lane_changes$Bike_lane_diff.by.street.2011.2016b250)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -38.5802 0.0000 0.8538 3.3168 4.9043 56.6588 233
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.area.2011.2016b250))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by area")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(bike_lane_changes$Bike_lane_diff.by.area.2011.2016b250)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -1.4622 0.0000 0.0000 0.4001 0.4306 6.2156
# buf500 level
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.2011.2016b500)), binwidth = 250) +
xlab("Difference of bike lane length between 2016 and 2011 | buf 500m")
summary(bike_lane_changes$Bike_lane_diff.2011.2016b250)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3452.5 0.0 0.0 646.7 933.8 20786.8
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.street.2011.2016b500))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by street")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 229 rows containing non-finite values (stat_bin).
summary(bike_lane_changes$Bike_lane_diff.by.street.2011.2016b500)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -26.891 0.000 1.385 3.298 5.323 22.121 229
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.area.2011.2016b500))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by area")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(bike_lane_changes$Bike_lane_diff.by.area.2011.2016b500)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -0.94397 0.00000 0.03393 0.38745 0.49370 4.00417
# buf750 level
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.2011.2016b750)), binwidth = 250) +
xlab("Difference of bike lane length between 2016 and 2011 | buf 750m")
summary(bike_lane_changes$Bike_lane_diff.2011.2016b750)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3697.5 0.0 578.6 1842.2 2928.6 29325.1
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.street.2011.2016b750))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by street")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 222 rows containing non-finite values (stat_bin).
summary(bike_lane_changes$Bike_lane_diff.by.street.2011.2016b750)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -4.7579 0.1418 1.7793 3.2961 5.2054 22.5448 222
ggplot(bike_lane_changes) +
geom_histogram(aes(as.numeric(Bike_lane_diff.by.area.2011.2016b750))) +
xlab("Difference of bike lane length between 2016 and 2011, normalized by area")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(bike_lane_changes$Bike_lane_diff.by.area.2011.2016b750)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -0.59760 0.00000 0.07793 0.38166 0.53774 3.95463
Canopy changes is based on data produced by CMM, using multispectral aerial imagery and lidar. In order to sync the observations with the census years, we focus on 2011 and 2019 with one extra observation point in 2015.
The processing steps are similar to the ones for the bike lanes:
# Codes du raster "espace vert"
# 0. No data (hors CMM)
# 1. NDVI < 0,3 et MNH < 3,0m = Minéral bas (route, stationnement, etc.)
# 2. NDVI < 0,3 et MNH ≥ 3,0m = Minéral haut (constructions)
# 3. NDVI ≥ 0,3 et MNH < 3,0m = Végétal bas (culture, gazon, etc.)
# 4. NDVI ≥ 0,3 et MNH ≥ 3,0m = Végétal haut (canopée)
# 5. Aquatique
# Load rasters into pg database for further processing
system('psql -d xgentrif_bei -c "CREATE EXTENSION IF NOT EXISTS postgis"')
system('psql -d xgentrif_bei -c "CREATE EXTENSION IF NOT EXISTS postgis_raster"')
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2019') IS NOT NULL;")) == 0) {
system("raster2pgsql -s 32188 -I -C -M data/canopy/2019/*.tif -F -t 1000x1000 canopee2019 | psql -d xgentrif_bei", intern = TRUE)
} else { message("PG Raster 'canopee2019' already imported") }
## PG Raster 'canopee2019' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2017') IS NOT NULL;")) == 0) {
system("raster2pgsql -s 32188 -I -C -M data/canopy/2017/*.tif -F -t 1000x1000 canopee2017 | psql -d xgentrif_bei", intern = TRUE)
} else { message("PG Raster 'canopee2017' already imported") }
## PG Raster 'canopee2017' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2015') IS NOT NULL;")) == 0) {
system("raster2pgsql -s 32188 -I -C -M data/canopy/2015/*.tif -F -t 1000x1000 canopee2015 | psql -d xgentrif_bei", intern = TRUE)
} else { message("PG Raster 'canopee2015' already imported") }
## PG Raster 'canopee2015' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2011') IS NOT NULL;")) == 0) {
system("raster2pgsql -s 32188 -I -C -M data/canopy/2011/*.tif -F -t 1000x1000 canopee2011 | psql -d xgentrif_bei", intern = TRUE)
} else { message("PG Raster 'canopee2011' already imported") }
## PG Raster 'canopee2011' already imported
# Resample to 10m as the original rasters have a 1m resolution, which is too high to allow for a swift processing
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2019_10m') IS NOT NULL;")) == 0) {
system("gdal_translate -of GTiff PG:\"host=localhost dbname=xgentrif_bei table=canopee2019 mode=2\" -r mode -tr 10 10 data/canopy/canopee2019_10m.tif")
system("raster2pgsql -s 32188 -I -C -M data/canopy/canopee2019_10m.tif -F -t 100x100 canopee2019_10m | psql -d xgentrif_bei")
} else { message("PG Raster 'canopee2019_10m' already imported") }
## PG Raster 'canopee2019_10m' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2017_10m') IS NOT NULL;")) == 0) {
system("gdal_translate -of GTiff PG:\"host=localhost dbname=xgentrif_bei table=canopee2017 mode=2\" -r mode -tr 10 10 data/canopy/canopee2017_10m.tif")
system("raster2pgsql -s 32188 -I -C -M data/canopy/canopee2017_10m.tif -F -t 100x100 canopee2017_10m | psql -d xgentrif_bei")
} else { message("PG Raster 'canopee2017_10m' already imported") }
## PG Raster 'canopee2017_10m' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2015_10m') IS NOT NULL;")) == 0) {
system("gdal_translate -of GTiff PG:\"host=localhost dbname=xgentrif_bei table=canopee2015 mode=2\" -r mode -tr 10 10 data/canopy/canopee2015_10m.tif")
system("raster2pgsql -s 32188 -I -C -M data/canopy/canopee2015_10m.tif -F -t 100x100 canopee2015_10m | psql -d xgentrif_bei")
} else { message("PG Raster 'canopee2015_10m' already imported") }
## PG Raster 'canopee2015_10m' already imported
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('canopee2011_10m') IS NOT NULL;")) == 0) {
system("gdal_translate -of GTiff PG:\"host=localhost dbname=xgentrif_bei table=canopee2011 mode=2\" -r mode -tr 10 10 data/canopy/canopee2011_10m.tif")
system("raster2pgsql -s 32188 -I -C -M data/canopy/canopee2011_10m.tif -F -t 100x100 canopee2011_10m | psql -d xgentrif_bei")
} else { message("PG Raster 'canopee2011_10m' already imported") }
## PG Raster 'canopee2011_10m' already imported
# Push CT16 to pg
if (nrow(dbGetQuery(con_bei, "SELECT 1 test WHERE to_regclass('ct16') IS NOT NULL;")) == 0) {
CT16 %>%
st_transform(crs = 32188) %>%
st_write(con_bei, "ct16",
layer_options = c("OVERWRITE=yes", "LAUNDER=true", "SPATIAL_INDEX=gist", "GEOMETRY_NAME=geom"))
system("psql -d xgentrif_bei -c 'CREATE INDEX ON ct16 USING gist (geometry)'")
} else { message("PG Layer CT16 already imported") }
## PG Layer CT16 already imported
UPDATE 2021-12-08: following discussion with Yan, we decide to focus on extracting canopy years in sync with census years, i.e. 2011 and 2017, and 2015 as an intermediary year. (Previously, we were using the last available year, i.e. 2019), plus keep the option of looking high/low canopy separately
WITH cnt19 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2019_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee19 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2019
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2019
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2019
FROM cnt19
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt17 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2017_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee17 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2017
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2017
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2017
FROM cnt17
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt15 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2015_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee15 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2015
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2015
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2015
FROM cnt15
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt11 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2011_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee11 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2011
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2011
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2011
FROM cnt11
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
)
SELECT "GeoUID"
,st_area(geometry) ct_area_m2
,coalesce(pct_esp_vert_low_2011, 0) pct_esp_vert_low_2011
,coalesce(pct_esp_vert_high_2011, 0) pct_esp_vert_high_2011
,coalesce(pct_esp_vert_2011, 0) pct_esp_vert_2011
,coalesce(pct_esp_vert_low_2015, 0) pct_esp_vert_low_2015
,coalesce(pct_esp_vert_high_2015, 0) pct_esp_vert_high_2015
,coalesce(pct_esp_vert_2015, 0) pct_esp_vert_2015
,coalesce(pct_esp_vert_low_2017, 0) pct_esp_vert_low_2017
,coalesce(pct_esp_vert_high_2017, 0) pct_esp_vert_high_2017
,coalesce(pct_esp_vert_2017, 0) pct_esp_vert_2017
,coalesce(pct_esp_vert_low_2019, 0) pct_esp_vert_low_2019
,coalesce(pct_esp_vert_high_2019, 0) pct_esp_vert_high_2019
,coalesce(pct_esp_vert_2019, 0) pct_esp_vert_2019
FROM ct16
FULL JOIN canopee19 USING ("GeoUID")
FULL JOIN canopee17 USING ("GeoUID")
FULL JOIN canopee15 USING ("GeoUID")
FULL JOIN canopee11 USING ("GeoUID");
WITH ct16 AS (
select "GeoUID", ST_Buffer(geometry, 250) geometry
from ct16
),
cnt19 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2019_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee19 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2019
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2019
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2019
FROM cnt19
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt17 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2017_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee17 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2017
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2017
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2017
FROM cnt17
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt15 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2015_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee15 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2015
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2015
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2015
FROM cnt15
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt11 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2011_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee11 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2011
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2011
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2011
FROM cnt11
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
)
SELECT "GeoUID"
,st_area(geometry) ct_area_m2
,coalesce(pct_esp_vert_low_2011, 0) pct_esp_vert_low_2011
,coalesce(pct_esp_vert_high_2011, 0) pct_esp_vert_high_2011
,coalesce(pct_esp_vert_2011, 0) pct_esp_vert_2011
,coalesce(pct_esp_vert_low_2015, 0) pct_esp_vert_low_2015
,coalesce(pct_esp_vert_high_2015, 0) pct_esp_vert_high_2015
,coalesce(pct_esp_vert_2015, 0) pct_esp_vert_2015
,coalesce(pct_esp_vert_low_2017, 0) pct_esp_vert_low_2017
,coalesce(pct_esp_vert_high_2017, 0) pct_esp_vert_high_2017
,coalesce(pct_esp_vert_2017, 0) pct_esp_vert_2017
,coalesce(pct_esp_vert_low_2019, 0) pct_esp_vert_low_2019
,coalesce(pct_esp_vert_high_2019, 0) pct_esp_vert_high_2019
,coalesce(pct_esp_vert_2019, 0) pct_esp_vert_2019
FROM ct16
FULL JOIN canopee19 USING ("GeoUID")
FULL JOIN canopee17 USING ("GeoUID")
FULL JOIN canopee15 USING ("GeoUID")
FULL JOIN canopee11 USING ("GeoUID");
WITH ct16 AS (
select "GeoUID", ST_Buffer(geometry, 500) geometry
from ct16
),
cnt19 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2019_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee19 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2019
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2019
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2019
FROM cnt19
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt17 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2017_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee17 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2017
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2017
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2017
FROM cnt17
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt15 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2015_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee15 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2015
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2015
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2015
FROM cnt15
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt11 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2011_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee11 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2011
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2011
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2011
FROM cnt11
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
)
SELECT "GeoUID"
,st_area(geometry) ct_area_m2
,coalesce(pct_esp_vert_low_2011, 0) pct_esp_vert_low_2011
,coalesce(pct_esp_vert_high_2011, 0) pct_esp_vert_high_2011
,coalesce(pct_esp_vert_2011, 0) pct_esp_vert_2011
,coalesce(pct_esp_vert_low_2015, 0) pct_esp_vert_low_2015
,coalesce(pct_esp_vert_high_2015, 0) pct_esp_vert_high_2015
,coalesce(pct_esp_vert_2015, 0) pct_esp_vert_2015
,coalesce(pct_esp_vert_low_2017, 0) pct_esp_vert_low_2017
,coalesce(pct_esp_vert_high_2017, 0) pct_esp_vert_high_2017
,coalesce(pct_esp_vert_2017, 0) pct_esp_vert_2017
,coalesce(pct_esp_vert_low_2019, 0) pct_esp_vert_low_2019
,coalesce(pct_esp_vert_high_2019, 0) pct_esp_vert_high_2019
,coalesce(pct_esp_vert_2019, 0) pct_esp_vert_2019
FROM ct16
FULL JOIN canopee19 USING ("GeoUID")
FULL JOIN canopee17 USING ("GeoUID")
FULL JOIN canopee15 USING ("GeoUID")
FULL JOIN canopee11 USING ("GeoUID");
WITH ct16 AS (
select "GeoUID", ST_Buffer(geometry, 750) geometry
from ct16
),
cnt19 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2019_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee19 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2019
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2019
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2019
FROM cnt19
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt17 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2017_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee17 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2017
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2017
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2017
FROM cnt17
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt15 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2015_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee15 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2015
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2015
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2015
FROM cnt15
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
),
cnt11 AS (
SELECT "GeoUID"
,(pvc).value, SUM((pvc).count) As total
FROM (SELECT "GeoUID"
,ST_ValueCount(ST_Clip(rast, geometry)) As pvc
FROM canopee2011_10m
JOIN ct16 ON ST_Intersects(geometry, rast)
) As foo
GROUP BY "GeoUID", (pvc).value
),
canopee11 AS (
SELECT "GeoUID"
,round(100. * sum(total) FILTER (WHERE value in (3, 4)) / sum(total), 2) AS pct_esp_vert_2011
,round(100. * sum(total) FILTER (WHERE value = 3) / sum(total), 2) AS pct_esp_vert_low_2011
,round(100. * sum(total) FILTER (WHERE value = 4) / sum(total), 2) AS pct_esp_vert_high_2011
FROM cnt11
WHERE value > 0 -- discard no data, including postgis raster no data
GROUP BY "GeoUID"
)
SELECT "GeoUID"
,st_area(geometry) ct_area_m2
,coalesce(pct_esp_vert_low_2011, 0) pct_esp_vert_low_2011
,coalesce(pct_esp_vert_high_2011, 0) pct_esp_vert_high_2011
,coalesce(pct_esp_vert_2011, 0) pct_esp_vert_2011
,coalesce(pct_esp_vert_low_2015, 0) pct_esp_vert_low_2015
,coalesce(pct_esp_vert_high_2015, 0) pct_esp_vert_high_2015
,coalesce(pct_esp_vert_2015, 0) pct_esp_vert_2015
,coalesce(pct_esp_vert_low_2017, 0) pct_esp_vert_low_2017
,coalesce(pct_esp_vert_high_2017, 0) pct_esp_vert_high_2017
,coalesce(pct_esp_vert_2017, 0) pct_esp_vert_2017
,coalesce(pct_esp_vert_low_2019, 0) pct_esp_vert_low_2019
,coalesce(pct_esp_vert_high_2019, 0) pct_esp_vert_high_2019
,coalesce(pct_esp_vert_2019, 0) pct_esp_vert_2019
FROM ct16
FULL JOIN canopee19 USING ("GeoUID")
FULL JOIN canopee17 USING ("GeoUID")
FULL JOIN canopee15 USING ("GeoUID")
FULL JOIN canopee11 USING ("GeoUID");
Get it here
pampalon <- read.xlsx("data/Canada2016Pampalon/A-MSDIData_Can2016_eng/1. EquivalenceTableCanada2016_ENG.xlsx", sheet = 2) %>%
mutate(DA = as.character(DA)) %>%
select(DA, SCOREMAT, SCORESOC)
# 2016 DA boundaries for Montreal
DA16 <- get_census(dataset='CA16', regions=list(CMA='24462'), level='DA', geo_format = "sf") %>%
filter(Type == "DA") %>%
st_transform(st_crs(bike_lane))
## Reading geo data from local cache.
pampalon <- DA16 %>%
inner_join(pampalon, by = c("GeoUID" = "DA")) %>%
as.data.frame()
# Get Pampalon 2006
pampalon06 <- read.xlsx("data/Canada2006Pampalon/A-MSDIData_Can2006_eng/1. CorrespondenceTable_Can2006_eng.xlsx", sheet = 2) %>%
mutate(DA = as.character(DA)) %>%
select(DA, DAPOP2006, SCOREMAT, SCORESOC)
# Get LUT DA2006 <-> DA2011 from StatCan
lut_da.1 <- read.csv("data/2011_92-156_DA_AD_txt/2011_92-156_DA_AD.txt", colClasses = "character",
header = FALSE, col.names = c("DAUID2011.ADIDU2011", "DAUID2006.ADIDU2006", "DBUID2011", "DA_rel_flag")) %>%
select(!c(DBUID2011, DA_rel_flag)) %>%
unique()
# Link Pampalon 2011 to LUT and compute weighted mean of scores of Pampalon 2011
# NB: population numbers will diverge from reality when more than one DA is merged into one DA of next census
pampalon06.11 <- pampalon06 %>%
inner_join(lut_da.1, by = c("DA" = "DAUID2006.ADIDU2006")) %>%
group_by(DAUID2011.ADIDU2011) %>%
summarise(pop2006 = sum(DAPOP2006),
SCOREMAT.06 = weighted.mean(SCOREMAT, DAPOP2006, na.rm = TRUE),
SCORESOC.06 = weighted.mean(SCORESOC, DAPOP2006, na.rm = TRUE))
# Get Pampalon 2011
pampalon11 <- read.xlsx("data/Canada2011Pampalon/A-MSDIData_Can2011_eng/1. CorrespondenceTable_Can2011_eng.xlsx", sheet = 2) %>%
mutate(DA = as.character(DA)) %>%
select(DA, DAPOP2011, SCOREMAT, SCORESOC)
# Get LUT DA2011 <-> DA2016 from StatCan
lut_da <- read.csv("data/2016_92-156_DA_AD_csv/2016_92-156_DA_AD.csv", colClasses = "character") %>%
select(!c(DBUID2016.IDIDU2016, DA_rel_flag.AD_ind_rel)) %>%
unique()
# Link Pampalon 2011 to LUT, then to Pampalon 06 and finally compute weighted mean of scores of Pampalon 2011
pampalon11.16 <- pampalon11 %>%
inner_join(lut_da, by = c("DA" = "DAUID2011.ADIDU2011")) %>%
left_join(pampalon06.11, by =c("DA" = "DAUID2011.ADIDU2011")) %>%
group_by(DAUID2016.ADIDU2016) %>%
summarise(pop2011 = sum(DAPOP2011),
SCOREMAT = weighted.mean(SCOREMAT, DAPOP2011, na.rm = TRUE),
SCORESOC = weighted.mean(SCORESOC, DAPOP2011, na.rm = TRUE),
SCOREMAT.06 = weighted.mean(SCOREMAT.06, pop2006, na.rm = TRUE),
SCORESOC.06 = weighted.mean(SCORESOC.06, pop2006, na.rm = TRUE),
pop2006 = sum(pop2006))
# Then link Pampalon 2011 to 2016
pampalon <- pampalon %>%
left_join(pampalon11.16, by = c("GeoUID" = "DAUID2016.ADIDU2016"), suffix = c(".16", ".11"))
# Aggregate at the CT level
pampalon_CT <- pampalon %>%
group_by(CT_UID) %>%
summarise(wSCOREMAT.2016 = weighted.mean(SCOREMAT.16, Population, na.rm = TRUE),
wSCORESOC.2016 = weighted.mean(SCORESOC.16, Population, na.rm = TRUE),
wSCOREMAT.2011 = weighted.mean(SCOREMAT.11, pop2011, na.rm = TRUE),
wSCORESOC.2011 = weighted.mean(SCORESOC.11, pop2011, na.rm = TRUE),
wSCOREMAT.2006 = weighted.mean(SCOREMAT.06, pop2006, na.rm = TRUE),
wSCORESOC.2006 = weighted.mean(SCORESOC.06, pop2006, na.rm = TRUE))
# Clean up
rm(lut_da, lut_da.1, pampalon11.16, pampalon06.11, pampalon11, pampalon06)
# Display map
pampalon_CT_geom <- CT16 %>%
left_join(pampalon_CT, by = c("GeoUID" = "CT_UID")) %>%
filter(interact_aoi)
pampalon_data <- bi_class(pampalon_CT_geom, x = wSCOREMAT.2016, y = wSCORESOC.2016, style = "quantile", dim = 3)
## Warning in classInt::classIntervals(bins_x, n = dim, style = "quantile"): var
## has missing values, omitted in finding classes
## Warning in classInt::classIntervals(bins_y, n = dim, style = "quantile"): var
## has missing values, omitted in finding classes
map <- ggplot() +
geom_sf(data = pampalon_data, mapping = aes(fill = bi_class), color = "white", size = 0.1, show.legend = FALSE) +
bi_scale_fill(pal = "DkBlue", dim = 3) +
labs(title = "Pampalon: material and social deprivation index") +
theme(panel.background = element_rect(fill = "white"),
#axis.ticks = element_blank(),
#axis.text = element_blank(),
panel.grid = element_line(color = "darkgray", size = 0.2))
legend <- bi_legend(pal = "DkBlue",
dim = 3,
xlab = "Material ",
ylab = "Social ",
size = 8)
ggdraw() +
draw_plot(map, 0, 0, 1, 1) +
draw_plot(legend, 0.1, .7, 0.2, 0.2)
# Load gentrified CTs, 5 year span (from repo gentrification_metrics)
ding <- list()
ding[["2016"]] <- st_read("data/gentrified_5years.gpkg", "gentrified_ding_16", quiet=TRUE) %>%
filter(cma_uid_16 == "24462") %>%
st_transform(st_crs(bike_lane))
ding[["2011"]] <- st_read("data/gentrified_5years.gpkg", "gentrified_ding_11", quiet=TRUE) %>%
filter(cma_uid_11 == "24462") %>%
st_transform(st_crs(bike_lane))
ding[["2006"]] <- st_read("data/gentrified_5years.gpkg", "gentrified_ding_06", quiet=TRUE) %>%
filter(cma_uid_06 == "24462") %>%
st_transform(st_crs(bike_lane))
ding_map <- ding[["2016"]] %>%
left_join(select(as.data.frame(CT16), GeoUID, interact_aoi), by = c("ct_uid_16" = "GeoUID")) %>%
filter(interact_aoi)
ggplot(data = ding_map) +
geom_sf(aes(fill = gentrified_2016_2011, colour=gentrifiable_2011)) +
scale_fill_manual(values = c("gray", "red", "darkgray"), name = "Gentrified in 2016") +
scale_colour_manual(values = c("darkgray", "darkred", "darkgray"), name = "Gentrifiable in 2011") +
labs(title = "Census tract gentrification status in 2016")
All variables + outcome linked at the CT level
.bike_lane_changes <- bike_lane_changes %>%
as.data.frame() %>%
select(GeoUID, ends_with("ct", ignore.case = FALSE), ends_with("b250", ignore.case = FALSE), ends_with("b500", ignore.case = FALSE), ends_with("b750", ignore.case = FALSE)) %>%
select(GeoUID, starts_with("Bike_lane")) # Drop individual category lane length
bei_df <- CT16 %>%
as.data.frame() %>%
transmute(CT_UID = GeoUID,
CD_UID = CD_UID,
CSD_UID = CSD_UID,
interact_aoi = interact_aoi,
Population = Population) %>%
left_join(pampalon_CT, by="CT_UID") %>%
left_join(.bike_lane_changes, by=c("CT_UID" = "GeoUID")) %>%
left_join(as.data.frame(esp_vert_ct), by=c("CT_UID" = "GeoUID")) %>%
left_join(as.data.frame(esp_vert_buf250), by=c("CT_UID" = "GeoUID"), suffix=c("ct", "b250")) %>%
left_join(as.data.frame(esp_vert_buf500), by=c("CT_UID" = "GeoUID")) %>%
left_join(as.data.frame(esp_vert_buf750), by=c("CT_UID" = "GeoUID"), suffix=c("b500", "b750")) %>%
left_join(select(as.data.frame(ding$`2016`), ct_uid_16, starts_with("gentrif")), by=c("CT_UID" = "ct_uid_16")) %>%
left_join(select(as.data.frame(ding$`2011`), ct_uid_11, starts_with("gentrif")), by=c("CT_UID" = "ct_uid_11")) %>%
left_join(select(as.data.frame(ding$`2006`), ct_uid_06, starts_with("gentrif")), by=c("CT_UID" = "ct_uid_06"))
head(bei_df)
write.csv(bei_df, "data/_results/bei_equity.csv", na="", row.names = FALSE)
Included variables:
CT_UID: 2016 Census Tract IDCD_UID: 2016 Census DivisionCSD_UID: 2016 Census Subdivisioninteract_aoi: Does CT belong to INTERACT study area?Population: 2016 Population within CTct_area_m2.{ct|b{250|500|750}}: Area of CT or buffer of 250, 500 or 750m radius around CT, in square metersgentrified_2016_2011: Is the CT gentrified in 2016?gentrifiable_2011: Is the CT candidate to gentrification in 2011?gentrified_2011_2006: Is the CT gentrified in 2011gentrifiable_2006: Is the CT candidate to gentrification in 2006gentrified_2006_2001: Is the CT gentrified in 2006gentrifiable_2001: Is the CT candidate to gentrification in 2001wSCOREMAT.2016: Social deprivation index in 2016 (population weighted)wSCORESOC.2016: Material deprivation index in 2016 (population weighted)wSCOREMAT.2011: Social deprivation index in 2011 (population weighted)wSCORESOC.2011: Material deprivation index in 2011 (population weighted)Bike_lane_total.{2016|2011}{ct|b{250|500|750}}: total length of bike lanes, in 2016 or 2011, within CT or buffer of 250, 500 or 750m radiusBike_lane.by.street.{2016|2011}{ct|b{250|500|750}}: % of bike lanes compared to streets, in 2016 or 2011, within CT or buffer of 250, 500 or 750m radiusBike_lane_diff.2011.2016{ct|b{250|500|750}}: change in total length of bike lanes between 2011 and 2011, within CT or buffer of 250, 500 or 750m radiusBike_lane_diff.by.street.2011.2016{ct|b{250|500|750}}: change in total length of bike lanes between 2011 and 2011, normalized by street length, within CT or buffer of 250, 500 or 750m radiusBike_lane_diff.by.area.2011.2016{ct|b{250|500|750}}: change in total length of bike lanes between 2011 and 2011, normalized by area, within CT or buffer of 250, 500 or 750m radiuspct_esp_vert_{2011|2015|2019}.{ct|b{250|500|750}}: % of green space in 2011, 2015 or 2019 within CT or buffer of 250, 500 or 750m radiuspct_esp_vert_{low|high}_{2011|2015|2019}.{ct|b{250|500|750}}: same as above, except for grass (low) and tree (high)pct_esp_vert_diff{2011|2015}.{2015|2019}.{ct|b{250|500|750}}: change in % of green space between 2011 and 2015, 2011 and 2019 as well as 2011 and 2019, within CT or buffer of 250, 500 or 750m radiusWhole area ~ Montréal CMA / CMM
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, starts_with("wSCORE")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 122 rows containing non-finite values (stat_bin).
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, starts_with("gentrif")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_bar() +
facet_wrap(~name, scales = "free", ncol = 3)
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*ct$"), matches("^pct_esp_vert_diff.*ct$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1008 rows containing non-finite values (stat_bin).
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b250$"), matches("^pct_esp_vert_diff.*b250$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 932 rows containing non-finite values (stat_bin).
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b500$"), matches("^pct_esp_vert_diff.*b500$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 916 rows containing non-finite values (stat_bin).
.bei_df_long <- bei_df %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b750$"), matches("^pct_esp_vert_diff.*b750$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 888 rows containing non-finite values (stat_bin).
INTERACT study area ~ Montréal, Laval, Longueuil, Brossard, St-Lambert
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, starts_with("wSCORE")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 86 rows containing non-finite values (stat_bin).
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, starts_with("gentrif")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_bar() +
facet_wrap(~name, scales = "free", ncol = 3)
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*ct$"), matches("^pct_esp_vert_diff.*ct$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b250$"), matches("^pct_esp_vert_diff.*b250$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b500$"), matches("^pct_esp_vert_diff.*b500$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
.bei_df_long <- bei_df %>%
filter(interact_aoi) %>%
units::drop_units() %>%
select(CT_UID, CD_UID, matches("^Bike_lane.*b750$"), matches("^pct_esp_vert_diff.*b750$")) %>%
pivot_longer(!c(CT_UID, CD_UID))
ggplot(.bei_df_long, aes(value)) +
geom_histogram() +
facet_wrap(~name, scales = "free", ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Looking at objective #1 | do urban interventions tend to be located in low SES neighborhoods?. We look at \[Urban Condition_{2011} = f(SES_{2011})\] as well as \[Urban Condition_{2011} = f(Gentrification_{2011 \to 2016})\]
Here \(UrbanCondition\) means the state of the urban environment features, such as length of bike lanes, greenness coverage, etc. This needs to be distinguished from \(UrbanIntervention\), which accounts for the changes in the \(UrbanConditions\) (see below).
Bike lane ratio to streets (in %)
ggplot(units::drop_units(bei_df), aes(y=Bike_lane.by.street.2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.692 -8.223 -2.539 4.865 91.035
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.3615 0.4427 21.146 <2e-16 ***
## wSCOREMAT.2011 -27.2836 10.8382 -2.517 0.012 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.66 on 701 degrees of freedom
## (267 observations deleted due to missingness)
## Multiple R-squared: 0.008959, Adjusted R-squared: 0.007545
## F-statistic: 6.337 on 1 and 701 DF, p-value: 0.01205
ggplot(units::drop_units(bei_df), aes(y=Bike_lane.by.street.2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.679 -6.135 -1.549 3.578 91.612
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.4442 0.3569 26.464 < 2e-16 ***
## wSCOREMAT.2011 -30.6466 8.8234 -3.473 0.000545 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.531 on 720 degrees of freedom
## (248 observations deleted due to missingness)
## Multiple R-squared: 0.01648, Adjusted R-squared: 0.01511
## F-statistic: 12.06 on 1 and 720 DF, p-value: 0.0005448
ggplot(units::drop_units(bei_df), aes(y=Bike_lane.by.street.2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.863 -4.306 -1.043 3.152 58.090
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.1999 0.2589 35.529 < 2e-16 ***
## wSCOREMAT.2011 -28.7292 6.4113 -4.481 8.63e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.931 on 723 degrees of freedom
## (245 observations deleted due to missingness)
## Multiple R-squared: 0.02702, Adjusted R-squared: 0.02568
## F-statistic: 20.08 on 1 and 723 DF, p-value: 8.634e-06
ggplot(units::drop_units(bei_df), aes(y=Bike_lane.by.street.2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.543 -3.805 -0.617 2.484 54.694
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.0780 0.2233 40.655 < 2e-16 ***
## wSCOREMAT.2011 -25.5780 5.5471 -4.611 4.73e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.008 on 730 degrees of freedom
## (238 observations deleted due to missingness)
## Multiple R-squared: 0.0283, Adjusted R-squared: 0.02697
## F-statistic: 21.26 on 1 and 730 DF, p-value: 4.731e-06
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -56.637 -12.862 0.022 11.451 55.361
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.6677 0.6414 64.960 < 2e-16 ***
## wSCOREMAT.2011 -134.5745 17.3456 -7.758 2.22e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.66 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.05976, Adjusted R-squared: 0.05877
## F-statistic: 60.19 on 1 and 947 DF, p-value: 2.22e-14
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -49.361 -10.527 -1.515 9.806 52.577
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.1560 0.5888 68.202 < 2e-16 ***
## wSCOREMAT.2011 -111.3184 15.9216 -6.992 5.13e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.04 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.04909, Adjusted R-squared: 0.04808
## F-statistic: 48.88 on 1 and 947 DF, p-value: 5.126e-12
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -48.103 -10.363 -1.419 9.521 53.004
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.1269 0.5747 69.822 < 2e-16 ***
## wSCOREMAT.2011 -102.7972 15.5411 -6.615 6.22e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 17.61 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.04416, Adjusted R-squared: 0.04315
## F-statistic: 43.75 on 1 and 947 DF, p-value: 6.224e-11
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -45.887 -11.012 -1.622 9.212 59.121
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.2943 0.5706 70.615 < 2e-16 ***
## wSCOREMAT.2011 -95.7911 15.4305 -6.208 8.02e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 17.49 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.0391, Adjusted R-squared: 0.03809
## F-statistic: 38.54 on 1 and 947 DF, p-value: 8.023e-10
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_high_2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.667 -6.512 -1.130 4.976 59.824
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 19.0646 0.3623 52.62 <2e-16 ***
## wSCOREMAT.2011 -99.5613 9.7983 -10.16 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.1 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.09831, Adjusted R-squared: 0.09736
## F-statistic: 103.2 on 1 and 947 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_high_2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.932 -5.623 -1.232 4.227 55.658
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.1746 0.3151 57.687 <2e-16 ***
## wSCOREMAT.2011 -84.8195 8.5197 -9.956 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.654 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.09475, Adjusted R-squared: 0.09379
## F-statistic: 99.12 on 1 and 947 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_high_2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.472 -5.196 -1.260 4.060 55.869
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.2182 0.3048 59.769 <2e-16 ***
## wSCOREMAT.2011 -80.1681 8.2427 -9.726 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.34 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.09082, Adjusted R-squared: 0.08986
## F-statistic: 94.59 on 1 and 947 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_high_2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.889 -5.029 -1.078 3.761 81.212
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.3174 0.3075 59.577 <2e-16 ***
## wSCOREMAT.2011 -77.0617 8.3142 -9.269 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.421 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.08317, Adjusted R-squared: 0.0822
## F-statistic: 85.91 on 1 and 947 DF, p-value: < 2.2e-16
Gentrified CT between 2011 and 2016
Bike lane ratio to streets (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 244 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011ct, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 113 112.6 0.829 0.363
## Residuals 701 95266 135.9
## 267 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 225 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b250, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 3 2.89 0.032 0.859
## Residuals 720 66058 91.75
## 248 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 222 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b500, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 21 21.01 0.43 0.512
## Residuals 723 35349 48.89
## 245 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 215 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b750, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 36 35.90 0.974 0.324
## Residuals 730 26911 36.86
## 238 observations deleted due to missingness
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011ct, na.rm = TRUE),
sd = sd(pct_esp_vert_2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 44236 44236 121 <2e-16 ***
## Residuals 945 345538 366
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b250, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 34642 34642 113 <2e-16 ***
## Residuals 945 289603 306
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b500, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 31182 31182 106.9 <2e-16 ***
## Residuals 945 275548 292
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b750, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 29134 29134 101.5 <2e-16 ***
## Residuals 945 271367 287
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011ct, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 2815 2815 21.16 4.81e-06 ***
## Residuals 945 125732 133
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b250, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1780 1780.0 17.75 2.76e-05 ***
## Residuals 945 94772 100.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b500, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1506 1506.3 16.12 6.42e-05 ***
## Residuals 945 88299 93.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b750, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1368 1367.9 14.47 0.000151 ***
## Residuals 945 89326 94.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
# keep only interact CT
bei_df_aoi <- filter(bei_df, interact_aoi)
Bike lane ratio to streets (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane.by.street.2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.200 -7.709 -2.064 5.143 59.255
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.8868 0.3611 24.613 < 2e-16 ***
## wSCOREMAT.2011 -27.1407 8.8021 -3.083 0.00213 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.409 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.01363, Adjusted R-squared: 0.0122
## F-statistic: 9.508 on 1 and 688 DF, p-value: 0.002128
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane.by.street.2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.4394 -5.3193 -0.8782 3.8947 24.9430
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.9081 0.2544 35.019 < 2e-16 ***
## wSCOREMAT.2011 -33.4497 6.2014 -5.394 9.49e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.629 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.04057, Adjusted R-squared: 0.03918
## F-statistic: 29.09 on 1 and 688 DF, p-value: 9.492e-08
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane.by.street.2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.7672 -3.9200 -0.7691 3.1333 20.7230
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.9691 0.2162 41.488 < 2e-16 ***
## wSCOREMAT.2011 -31.0529 5.2703 -5.892 5.97e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.634 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.04804, Adjusted R-squared: 0.04665
## F-statistic: 34.72 on 1 and 688 DF, p-value: 5.971e-09
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane.by.street.2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane.by.street.2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane.by.street.2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.5371 -3.5685 -0.5231 2.4075 18.3871
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.9986 0.1938 46.431 < 2e-16 ***
## wSCOREMAT.2011 -26.8673 4.7248 -5.686 1.92e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.05 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.04489, Adjusted R-squared: 0.0435
## F-statistic: 32.34 on 1 and 688 DF, p-value: 1.918e-08
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -48.859 -11.624 -0.331 8.977 47.657
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 37.9617 0.5933 63.988 < 2e-16 ***
## wSCOREMAT.2011 -109.4130 14.4631 -7.565 1.25e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.46 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.07679, Adjusted R-squared: 0.07545
## F-statistic: 57.23 on 1 and 688 DF, p-value: 1.247e-13
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -41.973 -8.235 -0.954 7.170 41.284
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36.0871 0.4897 73.690 < 2e-16 ***
## wSCOREMAT.2011 -90.8096 11.9387 -7.606 9.29e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.76 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.07757, Adjusted R-squared: 0.07623
## F-statistic: 57.86 on 1 and 688 DF, p-value: 9.289e-14
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -40.955 -8.076 -0.976 7.123 40.579
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36.1464 0.4645 77.820 < 2e-16 ***
## wSCOREMAT.2011 -83.2220 11.3236 -7.349 5.66e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.1 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.07279, Adjusted R-squared: 0.07145
## F-statistic: 54.01 on 1 and 688 DF, p-value: 5.662e-13
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -38.621 -8.282 -0.894 7.305 39.867
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36.211 0.451 80.287 < 2e-16 ***
## wSCOREMAT.2011 -76.126 10.995 -6.923 1.01e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.75 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.06513, Adjusted R-squared: 0.06377
## F-statistic: 47.93 on 1 and 688 DF, p-value: 1.013e-11
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_high_2011ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.954 -5.492 -0.802 4.630 44.704
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.8069 0.3379 55.66 <2e-16 ***
## wSCOREMAT.2011 -96.7463 8.2370 -11.74 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.805 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.167, Adjusted R-squared: 0.1658
## F-statistic: 138 on 1 and 688 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_high_2011b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.9166 -4.2910 -0.8451 3.4739 27.8788
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.6539 0.2668 66.17 <2e-16 ***
## wSCOREMAT.2011 -81.7658 6.5045 -12.57 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.953 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.1868, Adjusted R-squared: 0.1856
## F-statistic: 158 on 1 and 688 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_high_2011b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.4603 -4.0485 -0.9957 3.5770 26.5204
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.738 0.250 70.96 <2e-16 ***
## wSCOREMAT.2011 -76.880 6.094 -12.62 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.515 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.1879, Adjusted R-squared: 0.1867
## F-statistic: 159.1 on 1 and 688 DF, p-value: < 2.2e-16
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_high_2011b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_high_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_high_2011b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.6658 -3.9100 -0.6752 3.4947 25.5210
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.7572 0.2377 74.69 <2e-16 ***
## wSCOREMAT.2011 -72.9660 5.7960 -12.59 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.196 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.1872, Adjusted R-squared: 0.186
## F-statistic: 158.5 on 1 and 688 DF, p-value: < 2.2e-16
Gentrified CT between 2011 and 2016
Bike lane ratio to streets (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011ct, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 5 4.95 0.056 0.813
## Residuals 688 60902 88.52
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b250, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 2 1.67 0.037 0.847
## Residuals 688 31057 45.14
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b500, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 22 21.78 0.664 0.416
## Residuals 688 22580 32.82
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane.by.street.2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane.by.street.2011b750, na.rm = TRUE),
sd = sd(Bike_lane.by.street.2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane.by.street.2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 41 40.84 1.547 0.214
## Residuals 688 18163 26.40
## 15 observations deleted due to missingness
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011ct, na.rm = TRUE),
sd = sd(pct_esp_vert_2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 23284 23284 102.9 <2e-16 ***
## Residuals 688 155714 226
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b250, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 14776 14776 94.56 <2e-16 ***
## Residuals 688 107511 156
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b500, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 12682 12682 90.12 <2e-16 ***
## Residuals 688 96815 141
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_2011b750, na.rm = TRUE),
sd = sd(pct_esp_vert_2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 11029 11029 82.95 <2e-16 ***
## Residuals 688 91471 133
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011ct, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1856 1855.8 20.54 6.89e-06 ***
## Residuals 688 62160 90.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b250, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 786 786.4 13.43 0.000266 ***
## Residuals 688 40275 58.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b500, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 632 632.0 12.27 0.000491 ***
## Residuals 688 35449 51.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_high_2011b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_high_2011b750, na.rm = TRUE),
sd = sd(pct_esp_vert_high_2011b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_high_2011b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 476 476.4 10.2 0.00147 **
## Residuals 688 32147 46.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
Looking at objective #1 | do urban interventions tend to be located in low SES neighborhoods?. We look at \[Urban Intervention_{2011 \to 2016} = f(SES_{2011})\] as well as \[Urban Intervention_{2011 \to 2016} = f(Gentrification_{2011 \to 2016})\]
Here \(Urban Intervention\) means the changes in the urban environment features, such as variation of bike lane length, greenness coverage, etc.
Bike lane ratio to streets (in %)
ggplot(units::drop_units(bei_df), aes(y=Bike_lane_diff.by.street.2011.2016ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -103.753 -3.740 -3.698 0.892 96.265
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.7298 0.3677 10.143 <2e-16 ***
## wSCOREMAT.2011 -0.6843 9.0024 -0.076 0.939
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.686 on 701 degrees of freedom
## (267 observations deleted due to missingness)
## Multiple R-squared: 8.242e-06, Adjusted R-squared: -0.001418
## F-statistic: 0.005777 on 1 and 701 DF, p-value: 0.9394
ggplot(units::drop_units(bei_df), aes(y=Bike_lane_diff.by.street.2011.2016b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.131 -3.366 -2.454 1.626 53.114
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.3818 0.2232 15.152 <2e-16 ***
## wSCOREMAT.2011 -5.0689 5.5183 -0.919 0.359
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.961 on 720 degrees of freedom
## (248 observations deleted due to missingness)
## Multiple R-squared: 0.001171, Adjusted R-squared: -0.0002167
## F-statistic: 0.8438 on 1 and 720 DF, p-value: 0.3586
ggplot(units::drop_units(bei_df), aes(y=Bike_lane_diff.by.street.2011.2016b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.433 -3.254 -1.833 2.045 18.674
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.3600 0.1796 18.711 <2e-16 ***
## wSCOREMAT.2011 -5.4457 4.4463 -1.225 0.221
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.807 on 723 degrees of freedom
## (245 observations deleted due to missingness)
## Multiple R-squared: 0.00207, Adjusted R-squared: 0.0006902
## F-statistic: 1.5 on 1 and 723 DF, p-value: 0.2211
ggplot(units::drop_units(bei_df), aes(y=Bike_lane_diff.by.street.2011.2016b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.257 -3.118 -1.475 1.962 19.103
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.3432 0.1563 21.388 <2e-16 ***
## wSCOREMAT.2011 -4.6639 3.8831 -1.201 0.23
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.205 on 730 degrees of freedom
## (238 observations deleted due to missingness)
## Multiple R-squared: 0.001972, Adjusted R-squared: 0.000605
## F-statistic: 1.443 on 1 and 730 DF, p-value: 0.2301
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_2011.2017ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.387 -2.936 -0.804 1.387 40.976
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.7797 0.1764 27.092 <2e-16 ***
## wSCOREMAT.2011 -6.5201 4.7709 -1.367 0.172
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.406 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.001968, Adjusted R-squared: 0.0009145
## F-statistic: 1.868 on 1 and 947 DF, p-value: 0.1721
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_2011.2017b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.376 -2.658 -0.697 1.157 48.343
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.6272 0.1668 27.738 <2e-16 ***
## wSCOREMAT.2011 -10.4401 4.5112 -2.314 0.0209 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.112 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.005624, Adjusted R-squared: 0.004574
## F-statistic: 5.356 on 1 and 947 DF, p-value: 0.02087
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_2011.2017b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.712 -2.610 -0.636 1.021 42.968
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.5938 0.1619 28.375 <2e-16 ***
## wSCOREMAT.2011 -9.9613 4.3780 -2.275 0.0231 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.961 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.005437, Adjusted R-squared: 0.004387
## F-statistic: 5.177 on 1 and 947 DF, p-value: 0.02311
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_2011.2017b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.363 -2.528 -0.689 0.947 36.236
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.5701 0.1563 29.241 <2e-16 ***
## wSCOREMAT.2011 -10.4889 4.2264 -2.482 0.0132 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.789 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.006462, Adjusted R-squared: 0.005412
## F-statistic: 6.159 on 1 and 947 DF, p-value: 0.01325
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_high_2011.2017ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.9362 -1.4430 -0.2191 1.1718 11.7012
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.97785 0.07524 39.577 < 2e-16 ***
## wSCOREMAT.2011 -11.15190 2.03468 -5.481 5.43e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.306 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.03075, Adjusted R-squared: 0.02972
## F-statistic: 30.04 on 1 and 947 DF, p-value: 5.426e-08
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_high_2011.2017b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.5822 -1.1723 -0.1726 0.9719 7.2733
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.72401 0.06123 44.489 < 2e-16 ***
## wSCOREMAT.2011 -11.27199 1.65573 -6.808 1.76e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.876 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.04666, Adjusted R-squared: 0.04565
## F-statistic: 46.35 on 1 and 947 DF, p-value: 1.757e-11
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_high_2011.2017b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.0515 -1.0786 -0.1097 0.8717 7.7815
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.63377 0.05773 45.62 < 2e-16 ***
## wSCOREMAT.2011 -10.11663 1.56114 -6.48 1.47e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.769 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.04246, Adjusted R-squared: 0.04145
## F-statistic: 41.99 on 1 and 947 DF, p-value: 1.47e-10
ggplot(units::drop_units(bei_df), aes(y=pct_esp_vert_diff_high_2011.2017b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df))
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.9917 -1.0242 -0.0716 0.8835 6.7288
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.54472 0.05811 43.792 < 2e-16 ***
## wSCOREMAT.2011 -9.32873 1.57139 -5.937 4.08e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.781 on 947 degrees of freedom
## (21 observations deleted due to missingness)
## Multiple R-squared: 0.03588, Adjusted R-squared: 0.03486
## F-statistic: 35.24 on 1 and 947 DF, p-value: 4.08e-09
Gentrified CT between 2011 and 2016
Bike lane ratio to streets (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016ct, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 244 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016ct, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 784 784.4 8.461 0.00374 **
## Residuals 701 64986 92.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 267 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b250, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 225 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b250, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1172 1172 34.53 6.43e-09 ***
## Residuals 720 24449 34
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 248 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b500, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 222 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b500, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1045 1045.2 48.14 8.83e-12 ***
## Residuals 723 15697 21.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 245 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b750, x=gentrified_2016_2011)) +
geom_boxplot()
## Warning: Removed 215 rows containing non-finite values (stat_boxplot).
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b750, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 844 844.0 50.98 2.26e-12 ***
## Residuals 730 12086 16.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 238 observations deleted due to missingness
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017ct, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 0 0.033 0.001 0.973
## Residuals 945 27144 28.724
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b250, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 6 5.94 0.232 0.63
## Residuals 945 24218 25.63
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b500, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 6 5.686 0.236 0.627
## Residuals 945 22742 24.066
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b750, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 11 10.83 0.484 0.487
## Residuals 945 21143 22.37
## 23 observations deleted due to missingness
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017ct, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017ct ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 234 234.1 45.86 2.23e-11 ***
## Residuals 945 4824 5.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b250, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 191 190.88 55.7 1.91e-13 ***
## Residuals 945 3238 3.43
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b500, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 182.4 182.40 60.16 2.26e-14 ***
## Residuals 945 2865.3 3.03
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b750, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 188 188.01 61.36 1.27e-14 ***
## Residuals 945 2895 3.06
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 23 observations deleted due to missingness
# keep only interact CT
bei_df_aoi <- filter(bei_df, interact_aoi)
Bike lane ratio to streets (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane_diff.by.street.2011.2016ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.442 -3.695 -3.621 0.992 38.452
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.6795 0.2761 13.328 <2e-16 ***
## wSCOREMAT.2011 -1.2310 6.7303 -0.183 0.855
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.194 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 4.862e-05, Adjusted R-squared: -0.001405
## F-statistic: 0.03345 on 1 and 688 DF, p-value: 0.8549
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane_diff.by.street.2011.2016b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.425 -3.455 -2.437 1.626 27.938
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.4854 0.2095 16.637 <2e-16 ***
## wSCOREMAT.2011 -5.3511 5.1073 -1.048 0.295
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.459 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.001593, Adjusted R-squared: 0.0001418
## F-statistic: 1.098 on 1 and 688 DF, p-value: 0.2951
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane_diff.by.street.2011.2016b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.367 -3.310 -1.827 2.005 18.540
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.4779 0.1803 19.29 <2e-16 ***
## wSCOREMAT.2011 -6.4606 4.3960 -1.47 0.142
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.699 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.00313, Adjusted R-squared: 0.001681
## F-statistic: 2.16 on 1 and 688 DF, p-value: 0.1421
ggplot(units::drop_units(bei_df_aoi), aes(y=Bike_lane_diff.by.street.2011.2016b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(Bike_lane_diff.by.street.2011.2016b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = Bike_lane_diff.by.street.2011.2016b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.565 -3.039 -1.415 1.939 18.956
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.4705 0.1622 21.40 <2e-16 ***
## wSCOREMAT.2011 -5.5739 3.9538 -1.41 0.159
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.226 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.00288, Adjusted R-squared: 0.001431
## F-statistic: 1.987 on 1 and 688 DF, p-value: 0.1591
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_2011.2017ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.165 -1.944 -0.273 1.524 37.029
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.1619 0.1313 31.687 <2e-16 ***
## wSCOREMAT.2011 1.7219 3.2020 0.538 0.591
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.423 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.0004201, Adjusted R-squared: -0.001033
## F-statistic: 0.2892 on 1 and 688 DF, p-value: 0.5909
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_2011.2017b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.827 -1.729 -0.027 1.341 34.699
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.9602 0.1125 35.192 <2e-16 ***
## wSCOREMAT.2011 -1.7145 2.7434 -0.625 0.532
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.932 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.0005674, Adjusted R-squared: -0.0008853
## F-statistic: 0.3906 on 1 and 688 DF, p-value: 0.5322
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_2011.2017b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.614 -1.542 -0.055 1.293 32.079
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8940 0.1049 37.116 <2e-16 ***
## wSCOREMAT.2011 -1.2350 2.5576 -0.483 0.629
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.734 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.0003388, Adjusted R-squared: -0.001114
## F-statistic: 0.2332 on 1 and 688 DF, p-value: 0.6293
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_2011.2017b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_2011.2017b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_2011.2017b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.6691 -1.5113 -0.0059 1.2007 29.1958
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8425 0.1008 38.102 <2e-16 ***
## wSCOREMAT.2011 -1.7355 2.4585 -0.706 0.48
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.628 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.0007238, Adjusted R-squared: -0.0007286
## F-statistic: 0.4983 on 1 and 688 DF, p-value: 0.4805
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_high_2011.2017ct, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017ct ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017ct ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.8508 -1.4234 -0.3206 1.1810 11.3606
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.4314 0.0846 40.560 < 2e-16 ***
## wSCOREMAT.2011 -11.9113 2.0625 -5.775 1.16e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.205 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.04624, Adjusted R-squared: 0.04485
## F-statistic: 33.35 on 1 and 688 DF, p-value: 1.164e-08
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_high_2011.2017b250, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b250 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b250 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9628 -1.1429 -0.2624 0.8870 6.8083
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.15716 0.06809 46.369 < 2e-16 ***
## wSCOREMAT.2011 -12.18518 1.65991 -7.341 6.01e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.774 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.07264, Adjusted R-squared: 0.07129
## F-statistic: 53.89 on 1 and 688 DF, p-value: 6.007e-13
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_high_2011.2017b500, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b500 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b500 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.0396 -1.0949 -0.2033 0.7381 7.3251
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.07086 0.06356 48.316 < 2e-16 ***
## wSCOREMAT.2011 -10.94933 1.54945 -7.067 3.9e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.656 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.06767, Adjusted R-squared: 0.06632
## F-statistic: 49.94 on 1 and 688 DF, p-value: 3.902e-12
ggplot(units::drop_units(bei_df_aoi), aes(y=pct_esp_vert_diff_high_2011.2017b750, x=wSCOREMAT.2011)) +
geom_point() +
geom_smooth(method=lm)
res.lm <- lm(pct_esp_vert_diff_high_2011.2017b750 ~ wSCOREMAT.2011, data = units::drop_units(bei_df_aoi))
summary(res.lm)
##
## Call:
## lm(formula = pct_esp_vert_diff_high_2011.2017b750 ~ wSCOREMAT.2011,
## data = units::drop_units(bei_df_aoi))
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9569 -0.9961 -0.2127 0.7393 6.2521
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.99802 0.05853 51.218 < 2e-16 ***
## wSCOREMAT.2011 -10.33948 1.42699 -7.246 1.16e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.525 on 688 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.0709, Adjusted R-squared: 0.06955
## F-statistic: 52.5 on 1 and 688 DF, p-value: 1.158e-12
Gentrified CT between 2011 and 2016
Bike lane ratio to streets (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016ct, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 843 843.4 16.69 4.92e-05 ***
## Residuals 688 34767 50.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b250, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 1124 1123.9 39.8 5.03e-10 ***
## Residuals 688 19426 28.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b500, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 965 965.1 46.5 2.01e-11 ***
## Residuals 688 14280 20.8
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=Bike_lane_diff.by.street.2011.2016b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(Bike_lane_diff.by.street.2011.2016b750, na.rm = TRUE),
sd = sd(Bike_lane_diff.by.street.2011.2016b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(Bike_lane_diff.by.street.2011.2016b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 759 758.6 45.14 3.85e-11 ***
## Residuals 688 11563 16.8
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
Measuring canopy (i.e. greenness ~ grass & trees) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017ct, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 97 96.85 8.355 0.00397 **
## Residuals 688 7975 11.59
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b250, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 57 56.50 6.639 0.0102 *
## Residuals 688 5855 8.51
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b500, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 59 58.84 7.967 0.0049 **
## Residuals 688 5081 7.39
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_2011.2017b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_2011.2017b750, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_2011.2017b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_2011.2017b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 53 53.32 7.808 0.00535 **
## Residuals 688 4699 6.83
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
Measuring high canopy (i.e. trees only) ratio within CT/buffer in 2011 (in %)
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017ct, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017ct, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017ct, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017ct ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 106 106.33 21.42 4.4e-06 ***
## Residuals 688 3415 4.96
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b250, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b250, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b250, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b250 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 78.7 78.70 24.05 1.17e-06 ***
## Residuals 688 2251.4 3.27
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b500, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b500, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b500, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b500 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 70.9 70.89 25.03 7.18e-07 ***
## Residuals 688 1948.5 2.83
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
ggplot(drop_na(units::drop_units(bei_df_aoi), gentrified_2016_2011), aes(y=pct_esp_vert_diff_high_2011.2017b750, x=gentrified_2016_2011)) +
geom_boxplot()
bei_df_aoi %>%
units::drop_units() %>%
drop_na() %>%
group_by(gentrified_2016_2011) %>%
summarise(
count = n(),
mean = mean(pct_esp_vert_diff_high_2011.2017b750, na.rm = TRUE),
sd = sd(pct_esp_vert_diff_high_2011.2017b750, na.rm = TRUE)
)
# Compute the analysis of variance
res.aov <- aov(pct_esp_vert_diff_high_2011.2017b750 ~ gentrified_2016_2011, data = units::drop_units(bei_df_aoi))
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## gentrified_2016_2011 1 68.7 68.74 28.66 1.17e-07 ***
## Residuals 688 1649.8 2.40
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 15 observations deleted due to missingness
Below we summarize the trends linking SES and BE (looking at association at the 500m buffer scale and INTERACT study area).
| SES metric | BE metric | UC 2011 trend | UI 2011 -> 2016 trend |
|---|---|---|---|
| Pampalon / MAT 2011 | Bike lane | - | . |
| Pampalon / MAT 2011 | Greenness | - | . |
| Pampalon / MAT 2011 | Tree canopy | - | - |
| Pampalon / SOC 2011 | Bike lane | + | + |
| Pampalon / SOC 2011 | Greenness | - | + |
| Pampalon / SOC 2011 | Tree canopy | - | + |
| Gentrified 2011-2016 | Bike lane | . | + |
| Gentrified 2011-2016 | Greenness | - | + |
| Gentrified 2011-2016 | Tree canopy | - | + |
.: no significant association
-: negative association (higher SES metric => lower BE metric)
+: positive association (higher SES metric => higher BE metric)
Tackling part 2 of objective #1: a mltilevel model to test the reduction in socio-economic inequalities in urban conditions \[𝔼(UC_{ij} \mid X_{ij}) = \beta_{0j} + \beta_{1j} ∗ SES + \beta_{2j} ∗ Time + \beta_{3j} ∗ SES ∗ Time + \epsilon_{ij}\] Here, SES is measured through Pampalon Material Score and urban conditions as the ratio of bike lanes to streets within 500m buffers around CT for the INTERACT study area.
# Reformat data to be in long format. One wants data with the following columns:
# Bike_Length_by_street | Canopy | Canopy_tree | census_year | ScoreMat | ScoreSoc | Gentrified
# Get SCOREMAT
.bei_df_mlm.1 <- bei_df %>%
select(CT_UID, starts_with("wSCOREMAT")) %>%
pivot_longer(cols = starts_with("wSCOREMAT"),
names_to = "Year", names_prefix = "wSCOREMAT.",
values_to = "wSCOREMAT", values_drop_na = TRUE)
# Get SCORESOC
.bei_df_mlm.2 <- bei_df %>%
select(CT_UID, starts_with("wSCORESOC")) %>%
pivot_longer(cols = starts_with("wSCORESOC"),
names_to = "Year", names_prefix = "wSCORESOC.",
values_to = "wSCORESOC", values_drop_na = TRUE)
# Get gentrified flag
.bei_df_mlm.3 <- bei_df %>%
select(CT_UID, starts_with("gentrified_")) %>%
pivot_longer(cols = starts_with("gentrified_"),
names_to = "Year_span", names_prefix = "gentrified_",
values_to = "gentrified", values_drop_na = TRUE) %>%
extract(Year_span, "Year", "(\\d{4})_*")
# Get bike_lane
.bei_df_mlm.4 <- bei_df %>%
select(CT_UID, starts_with("Bike_lane.by.street")) %>%
pivot_longer(cols = starts_with("Bike_lane.by.street"),
names_to = "Var", names_prefix = "Bike_lane.by.street.",
values_to = "bike_lane.by.street", values_drop_na = TRUE) %>%
extract("Var", c("Year", "Spatial.scale"), "(\\d{4})([[:alnum:]]+)")
# Get Canopy
.bei_df_mlm.5 <- bei_df %>%
select(CT_UID, starts_with("pct_esp_vert_20")) %>%
pivot_longer(cols = starts_with("pct_esp_vert_"),
names_to = "Var", names_prefix = "pct_esp_vert_",
values_to = "pct_esp_vert", values_drop_na = TRUE) %>%
extract("Var", c("Year", "Spatial.scale"), "(\\d{4})([[:alnum:]]+)") %>%
filter(Year %in% c('2011', '2017')) %>%
mutate(Year = case_when(Year == '2017' ~ '2016',
TRUE ~ Year))
# Get Canopy
.bei_df_mlm.6 <- bei_df %>%
select(CT_UID, starts_with("pct_esp_vert_high_20")) %>%
pivot_longer(cols = starts_with("pct_esp_vert_high"),
names_to = "Var", names_prefix = "pct_esp_vert_high_",
values_to = "pct_esp_vert_high", values_drop_na = TRUE) %>%
extract("Var", c("Year", "Spatial.scale"), "(\\d{4})([[:alnum:]]+)") %>%
filter(Year %in% c('2011', '2017')) %>%
mutate(Year = case_when(Year == '2017' ~ '2016',
TRUE ~ Year))
# Combine all subsets
bei_df_mlm <- bei_df %>%
select(CT_UID, interact_aoi, Population) %>%
full_join(.bei_df_mlm.1, by=c("CT_UID")) %>%
full_join(.bei_df_mlm.2, by=c("CT_UID", "Year")) %>%
full_join(.bei_df_mlm.3, by=c("CT_UID", "Year")) %>%
full_join(.bei_df_mlm.4, by=c("CT_UID", "Year")) %>%
full_join(.bei_df_mlm.5, by=c("CT_UID", "Year", "Spatial.scale")) %>%
full_join(.bei_df_mlm.6, by=c("CT_UID", "Year", "Spatial.scale")) %>%
units::drop_units()
# Define multilevel model | buf 500m / INTERACT study area
mlm_data <- bei_df_mlm %>%
filter(Spatial.scale == 'b500' & interact_aoi)
res.mlm <- lmer(bike_lane.by.street ~ wSCOREMAT*Year + (1 | CT_UID), data = mlm_data)
summary(res.mlm)
## Linear mixed model fit by REML ['lmerMod']
## Formula: bike_lane.by.street ~ wSCOREMAT * Year + (1 | CT_UID)
## Data: mlm_data
##
## REML criterion at convergence: 12056
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6867 -0.5681 0.0150 0.4949 3.9660
##
## Random effects:
## Groups Name Variance Std.Dev.
## CT_UID (Intercept) 21.80 4.669
## Residual 10.16 3.187
## Number of obs: 2072, groups: CT_UID, 693
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 6.1993 0.2149 28.851
## wSCOREMAT -29.9994 5.0547 -5.935
## Year2011 2.7975 0.1733 16.141
## Year2016 6.0636 0.1716 35.338
## wSCOREMAT:Year2011 -6.6516 4.4342 -1.500
## wSCOREMAT:Year2016 -19.2242 4.4893 -4.282
##
## Correlation of Fixed Effects:
## (Intr) wSCOREMAT Yr2011 Yr2016 wSCOREMAT:Y2011
## wSCOREMAT -0.001
## Year2011 -0.395 -0.079
## Year2016 -0.399 -0.002 0.496
## wSCOREMAT:Y2011 0.002 -0.502 -0.061 -0.004
## wSCOREMAT:Y2016 0.003 -0.490 -0.001 -0.007 0.537